home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / PIKSRT.DEM < prev    next >
Text File  |  1991-04-29  |  784b  |  40 lines

  1. PROGRAM d8r1(input,output,dfile);
  2. (* driver for routine PIKSRT *)
  3. CONST
  4.    np=100;
  5. TYPE
  6.    glsarray = ARRAY [1..np] OF real;
  7. VAR
  8.    i,j : integer;
  9.    a : glsarray;
  10.    dfile : text;
  11.  
  12. (*$I MODFILE.PAS *)
  13. (*$I PIKSRT.PAS *)
  14.  
  15. BEGIN
  16.    glopen(dfile,'tarray.dat');
  17.    readln(dfile);
  18.    FOR i := 1 to 100 DO BEGIN
  19.       read(dfile,a[i])
  20.    END;
  21.    close(dfile);
  22. (* write original array *)
  23.    writeln ('original array:');
  24.    FOR i := 1 to 10 DO BEGIN
  25.       FOR j := 1 to 10 DO BEGIN
  26.          write(a[10*(i-1)+j]:6:2)
  27.       END;
  28.       writeln
  29.    END;
  30. (* write sorted array *)
  31.    piksrt(np,a);
  32.    writeln('sorted array:');
  33.    FOR i := 1 to 10 DO BEGIN
  34.       FOR j := 1 to 10 DO BEGIN
  35.          write(a[10*(i-1)+j]:6:2)
  36.       END;
  37.       writeln
  38.    END
  39. END.
  40.